extends "../../azurlane_ctrl/AzurItem.gd"
func init():
	.init()
	name = "[稀有]历战之证"
	att.atk = 0
	att.mgiAtk = 0
	att.maxHp = 0
	att.def = 0
	att.defR = 0
	info = """携带者受到炮击伤害，本装备护甲提升1点（上限150）
携带者受到真实伤害，本装备血量提升5点（上限500）
携带者造成炮击伤害，本装备炮击提升1点（上限150）
携带者造成雷击伤害，本装备雷击提升2点（上限150）
携带者阵亡，本装备提升伤害减免1%（上限15%）"""
var flag = true
func _upS():
	flag = true

func _connect():
	._connect()
	if masCha.team != 1:
		att.mgiAtk = 100
		att.atk = 100
		return
	masCha.connect("onAtkChara",self,"onAtkChara")
	masCha.connect("onHurt",self,"onHurt")
	masCha.connect("onDeath", self, "onDeath")
	sys.main.connect("onBattleStart",self,"start")

var enable = true
func start():
	enable = true	

func onDeath(atkInfo):
	if enable and att.defR < 0.15:
		enable = false
		att.defR += 0.01

func onAtkChara(atkInfo):
	if atkInfo.atkType == sys.AtkType.TORPEDO and att.mgiAtk < 150:
		att.mgiAtk += 2
	if not flag:return
	flag = false
	if atkInfo.atkType == sys.AtkType.GUN && att.atk < 150:
		att.atk += 1
	
func onHurt(atkInfo):
	if atkInfo.atkType == sys.AtkType.GUN && att.def < 150:
		att.def += 1
	elif atkInfo.hurtType == sys.HurtType.REAL && att.maxHp < 500:
		att.maxHp += 5